package com.jt.handler;

import com.jt.msg.req.RegisterMsg;
import com.jt.msg.resp.RegisterResp;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.stereotype.Component;

/**
 * 注册
 * <p>注册 是否成功 需要判断</p>
 *
 * @author wang xiao
 * date 2023/8/9
 */

@Component
@ChannelHandler.Sharable
public class RegisterMsgHandler extends BaseHandler<RegisterMsg> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, RegisterMsg msg) throws Exception {
        log.debug(msg.toString());
        RegisterResp resp = RegisterResp.success(msg, getSerialNumber(ctx.channel()));
        write(ctx, resp);
    }
}
